import yaml

with open("sample.yaml", 'r') as f:
  config = yaml.load(f, yaml.FullLoader)

def func(src, targetkey='' ):
    for k, v in src.items():
        func(v, targetkey=targetkey + k + '.') if isinstance(v, dict) else target.append((targetkey + k,v))

target = []
func(config)
print(target)